diag_log "M4_fnc_cargoAddWeaponInfo";
params["_container","_weaponInfo"];
// _container = _this select 0;
// _weaponInfo= _this select 1;

_weapon = _weaponInfo select 0;
_supp	= _weaponInfo select 1;
_laser  = _weaponInfo select 2;
_optic	= _weaponInfo select 3;
_magInfo= _weaponInfo select 4;
_glInfo	= [];
_bipod = "";

if(count _weaponInfo == 7) then
{ 
	_glInfo = _weaponInfo select 5; 
	_bipod = _weaponInfo select 6;
}
else
{ _bipod = _weaponInfo select 5; };				

_container addWeaponWithAttachmentsCargo [
	[
		_weapon, 
		_supp, 
		_laser, 
		_optic, 
		_magInfo, 
		_glInfo, 
		_bipod
	], 
	1
];